package cn.hxth.cloud.provider.updater;


import cn.hxth.cloud.api.common.util.DateProvider;
import cn.hxth.cloud.api.domain.Steels;
import cn.hxth.cloud.api.domain.SteelsInputOrderItem;

import cn.hxth.cloud.api.mapper.SteelsMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

public class InPutSteelsUpdater extends AbstractSteelsUpdater {
    private Map<Long,SteelsInputOrderItem> map ;
    @Autowired
    public InPutSteelsUpdater(List<Steels> steelses, SteelsMapper steelsMapper, DateProvider dateProvider, Map<Long, SteelsInputOrderItem> map) {
        super(steelses, steelsMapper, dateProvider);
        this.map = map;
    }


    @Override
    protected void updateLockedInventory() {

    }

    @Override
    protected void updateInventory() {
        for(Steels steels:steelses){
            SteelsInputOrderItem steelsInputOrderItem = map.get(steels.getId());
            steels.setInventory(steels.getInventory()+steelsInputOrderItem.getCount());
        }
    }
}

